<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Document</title>
	</head>
	<body>
		<script type="text/javascript">
			
			let n = window.prompt('请输入杨辉三角的层数');
			
			let arr = [
				[1],
				[1,1]
				//[1,2,1]
				//[1,3,3,1]
			]
			
			for (let i = 2; i <= n; i++) {
				let temp = [];
				temp[0]=1;
				temp[i]=1;
				for(let j = 1;j < i; j++){
					temp[j]=arr[i-1][j-1]+arr[i-1][j];
				}
				arr[i]=temp;
			}
			
			for (let v of arr) {
				console.log(v);
			}
			
		</script>
	</body>
</html>
